package com.lovo.frame;

import com.lovo.util.Util;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Inquire extends JPanel implements ActionListener {


    private JLabel label = new JLabel();
    private Icon icon = Util.getIcon("/img/buttonOff.jpg");
    private JButton outButton;

    public JLabel getLabel() {
        return label;
    }

    public void setLabel(JLabel label) {
        this.label = label;
    }

    private Atm frame;


    public Inquire(Atm frame) {

        this.frame = frame;

        this.setLayout(null);
        label.setBounds(452, 268, 80, 20);
        this.add(label);

        outButton = new JButton(icon);
        outButton.setBounds(471, 400, 140, 50);
        outButton.addActionListener(this);
        this.add(outButton);

        JLabel balanceLabel = new JLabel();
        label.setBounds(532, 268, 100, 20);
        this.add(balanceLabel);

        this.setOpaque(false);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == outButton) {
            frame.switchPanel("menu");
        }
    }
}
